# !/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :create_thread.py
# @Time      :2025/7/5 20:14
# @Author    :aiyimu

import threading
import test
import time


def worker(num):
    print(f"线程{num}开始")
    time.sleep(2) # 模拟耗时操作
    print(f"线程{num}结束")

# 创建线程
threads = []
for i in range(3):
    t = threading.Thread(target=worker, args=(i, ))
    threads.append(t)
    t.start()

# 等待线程完成
for t in threads:
    t.join()

print("所有线程执行完毕")